import {
    findDetailedInfoById,
    findDetailedById,
    findDetailedOrderImelById,
    insertImel,
    holdImel
} from '@/api/sales/salesOutbound'

export default {
    data() {
        return {
            detailedList:[],
            detailedInfo:[],
            detailedOrderImel:[],
            outImel:'',
            nums:{},
            inputImel:[]

        }
    },
    methods: {
        async findDetailedInfoById() {
            this.detailedInfo = await findDetailedInfoById(this.$route.params.id);
        },
        async findDetailedById() {
            this.detailedList = await findDetailedById(this.$route.params.id)
        },
        async findDetailedOrderImelById(){
            this.detailedOrderImel = await findDetailedOrderImelById(this.$route.params.id)
        },
        //终极模糊解决方案
        commitImel(status){
            this.inputImel= [];
            this.nums = this.$refs.test
            this.inputImel.push(this.$route.params.id)
            for(let i=0;i<this.nums.length;i++){
                this.inputImel.push(this.nums[i].value)
            }
            if (status){
                insertImel(this.inputImel).then(r => {
                    this.$notify({
                        title: '成功',
                        message: r,
                        type: 'success'
                    });
                    this.$router.push('/salesOutbound')
                })
            }else {
                holdImel(this.inputImel).then(r => {
                    this.$notify({
                        title: '成功',
                        message: r,
                        type: 'success'
                    });
                    this.$router.push('/salesOutbound')
                })
            }

        },
        createBatchExcel(){
            console.log(this.batchIds)
        },
        lookBack(){
            this.$router.push('/salesOutbound')
        }
        // putList(outImel) {
        //     this.outImel.push({
        //         id: outImel.id,
        //         imel: outImel.outImel
        //     })
        // }
    },
    created() {
        this.findDetailedInfoById()
        this.findDetailedById()
        this.findDetailedOrderImelById()
    }
}